using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using NetCoreClass;
using System.Net;
using System.Net.Http.Headers;

using GoodDotNet.Core.Model;
using  GoodDotNet.Core.Entity;
using GoodDotNet.Service;
using GoodDotNet.Core.Data;
using GoodDotNet.Core.Model.Params;
using GoodDotNet.WebAdmin.HttpContextUser;


namespace GoodDotNet.WebAdmin.Controllers
{
  
  /**
   *
   * @author 大钊
   * @since 2023/9/17 10:42:45
   */
    [ApiController]
	[Route("api/[controller]")]
	public class UserLogController : BaseController
	{
      public UserLogController(IUser user, IHttpContextAccessor accessor, IOptions<List<ConnectionString>> conns, ILogger<BaseController> logger, IOptions<Appsettings> appsettings,IOptions<Audiences>audience) : base(user, accessor, conns, logger, appsettings)
            {
    		    }

	
		
		/// @author 大钊
		/// @since 2023/9/17 10:42:45
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		[HttpPost]
		[Route("GetPage")]
		[Authorize]
		public Result GetPage([FromBody] UserLogGetPageParModel pars)
		{
		  using (var uniOfWork = new UnitOfWork(_conStr))
		  {
		    UserLogService service = new UserLogService(uniOfWork);
		    var obj= service.GetPage(pars);
				return Sucess(obj);
		  }
		}
		


		
		/// @author 大钊
		/// @since 2023/9/17 10:42:45
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		[HttpPost]
		[Route("GetPageUser")]
		[Authorize]
		public Result GetPageUser([FromBody] UserLogGetPageUserParModel pars)
		{
		  using (var uniOfWork = new UnitOfWork(_conStr))
		  {
		    UserLogService service = new UserLogService(uniOfWork);
		    var obj= service.GetPageUser(pars);
				return Sucess(obj);
		  }
		}
		


		
		/// @author 大钊
		/// @since 2023/9/17 16:57:09
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		[HttpPost]
		[Route("AddTest")]
		[Authorize]
		public Result AddTest([FromBody] UserLogAddTestParModel pars)
		{
		  using (var uniOfWork = new UnitOfWork(_conStr))
		  {
		    UserLogService service = new UserLogService(uniOfWork);
		    service.AddTest(pars);
		  }
		  return Sucess("sucess");
		}
		
		
		

}
}
